/*
 * Copyright (c) 2012 Shanda Corporation. All rights reserved.
 *
 * Created on 2012-8-17.
 */

package com.whq.knowverywell.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
import android.widget.TextView;

import com.whq.knowverywell.business.http.LoginUtil;
import com.whq.knowverywell.util.LogUtil;

/**
 * 登录后的acivity基类.
 *
 * @author wanghuaiqiang
 */
public class BaseLoginActivity extends BaseActivity {
    private final static String TAG = "BaseLoginActivity";
    
    public static final int MENU_ITEM_ID_LOGOUT 			= 10;
    public static final int MENU_ITEM_ID_MANAGER_ACCOUNT 	= 20;
    public static final int MENU_ITEM_ID_ABOUT 				= 30;
    
    protected TextView mSelectedTextView, mSumTextView, mAmountTextView;
	
    protected String[] itemTitles = new String[]{"汇总统计","地域分析","品类分析","货品查询","热销查询"};
    protected int itemId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        LogUtil.d(TAG, "onCreate start ...");
        super.onCreate(savedInstanceState);
        getParameters();
        
    }
    
    @Override
    protected void onResume() {
    	super.onResume();
    	
    	if (!LoginUtil.chkLogin(this)) {
    		Toast.makeText(BaseLoginActivity.this, "您已经退出登录或者在其他设备上登录！",
					Toast.LENGTH_SHORT).show();
    		
    		
    		Intent intent = new Intent(this, LoginActivity.class);
    		startActivity(intent);
    		this.finish();
    		return ;
    	}
    }
    
    // --------- customize method ---------
    protected void getParameters() {
		
	}
    
    protected void go2ManagerAccount() {
    	Intent intent = new Intent(BaseLoginActivity.this, ManagerAccountActivity.class);
    	startActivity(intent);
    }
    

}
